---
import '@styles/base.min.css'
import { getUniqueTags } from '@utils/astroUtil'
import { getCollection } from 'astro:content'

const tags = getUniqueTags(await getCollection("posts"))
---

<section class="footer-wrapper">
    <footer class="footer-cont">

        <!-- 
        <div class="blog-nav">
            <div class="nav-title">导航</div>
            <nav class="link-navs">
                <a class="link" href="/">首页</a>
                <a class="link" href="/blogs">归档</a>
                <a class="link" href="/notes/1">随笔</a>
                <a class="link" href="/about">关于</a>
            </nav>
        </div> 
        -->

        <div class="tags-nav">
            <div class="nav-title">标签</div>
            <nav class="links flexbox">
                {
                    tags.map(tag => {
                        return (
                            <a href="javascript:void(0)" class="link flexbox">
                                { tag.tag } <span class="tag-count">({ tag.count })</span>
                            </a>
                        )
                    })
                }
            </nav>
        </div>

    </footer>
</section>

<style lang="scss" scoped>
.footer-wrapper {
    padding: 40px 0;
    margin: 60px auto 0;
    width: 100%;
    background-color: var(--bodyBGC);
    box-shadow: 0 1px 8px rgba(0, 0, 0, .2);
    .footer-cont {
        margin: 0 auto 0;
        max-width: 686px;
        min-width: 360px;
    }
    .nav-title {
        margin-bottom: 16px;
        font-weight: 400;
        font-size: var(--fontsBIG);
        line-height: 1.6;
        text-align: center;
        color: var(--textColor1);
    }
    .tags-nav {
        margin: 0 auto 0;
        width: 80%;
        .links {
            flex-wrap: wrap;
            gap: 8px;
            .link {
                padding: 0 8px;
                min-width: 80px;
                height: 30px;
                font-size: var(--fontsSM);
                color: var(--textColor2);
                border: 1px solid var(--textColor2);
                transition: var(--baseTran);
                &:hover {
                    color: var(--mainColor);
                    border-color: var(--mainColor);
                    .tag-count {
                        opacity: .8;
                    }
                }
            }
            .tag-count {
                transition: var(--baseTran);
                font-size: var(--fontsMini);
                color: var(--textColor2);
                opacity: 0.5;
            }
        }
    }
    .blog-nav {
        .link-navs {
            width: 80px;
            .link {
                padding-left: 20px;
                position: relative;
                display: block;
                font-family: var(--baseFont);
                font-size: var(--fontsBase);
                line-height: 1.6;
                transition: var(--baseTran);
                color: var(--textColor4);
                &:hover {
                    color: var(--mainColor);
                }
                &::before {
                    content: '';
                    position: absolute;
                    top: calc(50% - 1px);
                    left: 4px;
                    width: 6px;
                    height: 2px;
                    background-color: var(--textColor4);
                }
            }
        }     
    }
}

@media screen and (max-width: 786px) {
    .footer-wrapper { 
        margin: 40px auto 0;
    } 
}
</style>
